Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::MessageArguments Class Reference

MessageArguments is the base class for arguments passed in messages. More...

#include <kanzi/core.ui/message/message_arguments.hpp>

Inheritance diagram for kanzi::MessageArguments:
[legend]

Classes

struct  ArgumentEntry
 Linked list entry containing arguments type and value. More...
 

Public Member Functions

bool getAbstractArgument (AbstractPropertyType argumentType, Variant &variant) const
 Returns the value of an argument using AbstractPropertyType. More...
 
template<typename TDataType >
TDataType getArgument (const PropertyType< TDataType > &argumentType) const
 Returns the value of an argument. More...
 
detail::MessageDispatcher * getDispatcher () const
 Returns the message dispatcher that dispatches a message. More...
 
template<typename TDataType >
optional< TDataType > getOptionalArgument (const PropertyType< TDataType > &argumentType) const
 Returns the value of an argument. More...
 
shared_ptr< NodegetSource () const
 Returns the source node for a message. More...
 
TimePoint getTimestamp () const
 Returns the timestamp of a message. More...
 
AbstractMessageType getType () const
 Returns the message type of these message arguments as an AbstractMessageType instance. More...
 
bool isFrom (const Node &source) const
 Returns whether a node is the source node of a message. More...
 
bool isHandled () const
 Returns whether the message is handled. More...
 
bool isValid () const
 Returns whether a message is valid. More...
 
 MessageArguments ()=default
 Constructor. More...
 
 MessageArguments (const MessageArguments &)=delete
 Deleted copy. More...
 
MessageArgumentsoperator= (const MessageArguments &)=delete
 Deleted assignment. More...
 
void setAbstractArgument (AbstractPropertyType argumentType, const Variant &variant)
 Sets the value of an argument using AbstractPropertyType. More...
 
template<typename TDataType >
void setArgument (const PropertyType< TDataType > &argumentType, typename PropertyType< TDataType >::DataType value)
 Sets the value of an argument. More...
 
void setDispatcher (detail::MessageDispatcher *dispatcher)
 Sets a dispatcher for a message. More...
 
void setHandled (bool handled)
 Sets the handling status for a message. More...
 
void setSource (Node *source)
 Sets the source node that dispatches a message. More...
 
void setTimestamp (TimePoint timestamp)
 Sets the timestamp of a message. More...
 
void setType (AbstractMessageType type)
 Sets the type of a message. More...
 
void setValid (bool valid)
 Sets the validity of a message. More...
 
 ~MessageArguments ()
 Destructor. More...
 

Static Public Member Functions

static size_t getArgumentAllocatorPoolSize ()
 Gets the current size of memory pool of argument entries. More...
 
static const MetaclassgetStaticMetaclass ()
 Initializes and returns static metadata of base MessageArguments class. More...
 
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 Initializes and returns the Kanzi Studio editor information. More...
 

Detailed Description

MessageArguments is the base class for arguments passed in messages.

An instance of MessageArguments together with an instance of MessageType forms a Kanzi message. In Kanzi when you dispatch a message, you dispatch a message of certain type and arguments.

While MessageArguments is a base class where you can inherit your own specialized arguments, MessageType is a templated class which takes message argument type as its template parameter. In practice this means that each MessageType is linked with a certain MessageArguments type. You can derive your own arguments class or use the MessageArguments base class. Note that MessageArguments as a base class carries only the basic message information, such as the timestamp and source of the message. To dispatch any other data with your messages, inherit your own message arguments class.

You can link a message type with only one type of message arguments, but you can use a certain type of message arguments with multiple message types. See MessageType.

See also
For examples on using Kanzi message arguments, message types and messages in general, see Node and MessageType.

Constructor & Destructor Documentation

kanzi::MessageArguments::MessageArguments ( )
explicitdefault

Constructor.

kanzi::MessageArguments::~MessageArguments ( )

Destructor.

kanzi::MessageArguments::MessageArguments ( const MessageArguments )
delete

Deleted copy.

Member Function Documentation

MessageArguments& kanzi::MessageArguments::operator= ( const MessageArguments )
delete

Deleted assignment.

template<typename TDataType >
TDataType kanzi::MessageArguments::getArgument ( const PropertyType< TDataType > &  argumentType) const
inline

Returns the value of an argument.

Parameters
argumentTypeThe PropertyType argument whose value to fetch.
Returns
The value of the argument. If the argument is not present in this message arguments instance, returns the default value of the PropertyType.
template<typename TDataType >
optional<TDataType> kanzi::MessageArguments::getOptionalArgument ( const PropertyType< TDataType > &  argumentType) const
inline

Returns the value of an argument.

Parameters
argumentTypeThe PropertyType argument whose value to fetch.
Returns
The value of the argument. If the argument is not present in this message arguments instance, returns nullopt.
bool kanzi::MessageArguments::getAbstractArgument ( AbstractPropertyType  argumentType,
Variant variant 
) const

Returns the value of an argument using AbstractPropertyType.

Parameters
argumentTypeThe AbstractPropertyType argument whose value to get.
variantThe variant where to store the message argument value.
Returns
If the argumentType is present in this message arguments instance, true, otherwise false.
template<typename TDataType >
void kanzi::MessageArguments::setArgument ( const PropertyType< TDataType > &  argumentType,
typename PropertyType< TDataType >::DataType  value 
)
inline

Sets the value of an argument.

Parameters
argumentTypeThe PropertyType argument whose value to set.
valueThe value to set for the argument.
void kanzi::MessageArguments::setAbstractArgument ( AbstractPropertyType  argumentType,
const Variant variant 
)

Sets the value of an argument using AbstractPropertyType.

Parameters
argumentTypeThe AbstractPropertyType argument whose value to set.
variantThe variant whose value to store to the message argument value.
bool kanzi::MessageArguments::isFrom ( const Node source) const
inline

Returns whether a node is the source node of a message.

Parameters
sourceThe node to check.
Returns
If the passed node is the source of the message, true, otherwise false.
shared_ptr<Node> kanzi::MessageArguments::getSource ( ) const

Returns the source node for a message.

Returns
The source node where the message was dispatched.
void kanzi::MessageArguments::setHandled ( bool  handled)
inline

Sets the handling status for a message.

Parameters
handledThe new handling status.
bool kanzi::MessageArguments::isHandled ( ) const
inline

Returns whether the message is handled.

Returns
If the message is handled, true, otherwise false.
TimePoint kanzi::MessageArguments::getTimestamp ( ) const
inline

Returns the timestamp of a message.

Returns
The timestamp of the message.
detail::MessageDispatcher* kanzi::MessageArguments::getDispatcher ( ) const
inline

Returns the message dispatcher that dispatches a message.

Returns
The MessageDispatcher that dispatches the message.
AbstractMessageType kanzi::MessageArguments::getType ( ) const
inline

Returns the message type of these message arguments as an AbstractMessageType instance.

Returns
The AbstractMessageType of these message arguments.
void kanzi::MessageArguments::setSource ( Node source)
inline

Sets the source node that dispatches a message.

Parameters
sourceThe source of the message.
void kanzi::MessageArguments::setTimestamp ( TimePoint  timestamp)
inline

Sets the timestamp of a message.

Parameters
timestampThe timestamp of the message.
void kanzi::MessageArguments::setValid ( bool  valid)
inline

Sets the validity of a message.

Parameters
validThe validity of the message.
bool kanzi::MessageArguments::isValid ( ) const
inline

Returns whether a message is valid.

Returns
If the message is valid, returns true, otherwise false.
void kanzi::MessageArguments::setDispatcher ( detail::MessageDispatcher *  dispatcher)
inline

Sets a dispatcher for a message.

Parameters
dispatcherMessage dispatcher that dispatches the message.
void kanzi::MessageArguments::setType ( AbstractMessageType  type)
inline

Sets the type of a message.

Parameters
typeThe type of the message.
static size_t kanzi::MessageArguments::getArgumentAllocatorPoolSize ( )
static

Gets the current size of memory pool of argument entries.

static const Metaclass* kanzi::MessageArguments::getStaticMetaclass ( )
static

Initializes and returns static metadata of base MessageArguments class.

Returns
Metaclass object holding metadata of base MessageArguments class.
static PropertyTypeEditorInfoSharedPtr kanzi::MessageArguments::makeEditorInfo ( )
inlinestatic

Initializes and returns the Kanzi Studio editor information.

Returns
Editor information for Kanzi Studio.

The documentation for this class was generated from the following file: